from django.contrib import admin
from pagemagic.utils.adminutils import create_advanced_admin_form
import models


class TextAdmin(admin.ModelAdmin):
    list_display = (
        'name',
        'text',
    )


class ImageAdmin(admin.ModelAdmin):
    form = create_advanced_admin_form(models.Image)
    #change_list_template = 'images_change_list.html'
    ordering = ('-id',)
    list_display = (
        'description',
        'adm_preview_image',
        'adm_path',
        'adm_code',
    )
    list_display_links = (
        'description',
        'adm_preview_image',
    )
    list_per_page = 20


class FileAdmin(admin.ModelAdmin):
    form = create_advanced_admin_form(models.File)
    ordering = ('-id',)
    list_display = (
        'description',
        'adm_code',
    )
    list_display_links = (
        'description',
    )
    #list_per_page = 15

admin.site.register(models.Text, TextAdmin)
admin.site.register(models.Image, ImageAdmin)
admin.site.register(models.File, FileAdmin)

